package com.wjk.kylin.id.core.spring.boot.autoconfigure;

import com.wjk.kylin.id.core.util.HttpUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
 * @author wjk
 */
@Configuration
@EnableConfigurationProperties({KylinIdProperties.class})
public class KylinIdAutoConfiguration {
    private static final Logger LOGGER = LoggerFactory.getLogger(KylinIdAutoConfiguration.class);

    @Autowired
    private KylinIdProperties kylinIdProperties;

    @PostConstruct
    public void init() {
        //
        HttpUtil.init(kylinIdProperties.getConnectTimeout(), kylinIdProperties.getReadTimeout(), kylinIdProperties.getWriteTimeout());

        LOGGER.info(">>>>>>>>>>> kylin-id init properties:{}", kylinIdProperties);
    }
}


